<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>001</title>

    <script>
        // 构建异步请求对象 xhr
        var xhr = new XMLHttpRequest();

        // 以兼容的方式构建 异步请求对象 xhr
        function createXHR() {
            // 现在基本不需要做兼容的处理
            var xhr;
            if(window.XMLHttpRequest){
                // Mozilla, Safari, Chrome, IE7+, ...
                xhr = new XMLHttpRequest();
            } else if(window.ActiveXObject) {
                // IE6 or older
                xhr = new ActiveXObject("Microsoft.XMLHTTP");
            } else {
                alert("您的浏览器不支持Ajax请求");
            }
            return xhr;
        }

    </script>

</head>
<body>
    
</body>
</html>